#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>
int main()
{
	int n,t=0;
	scanf("%d", &n);
	int arr[10000] = { 0 };
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	for (int i = 0; i < n - 1; i++)
	{
		for (int j = 1; j < n - i; j++)
		{
			int tmp;
			if (arr[j - 1] > arr[j])
			{
				tmp = arr[j - 1];
				arr[j - 1] = arr[j];
				arr[j] = tmp;
				t++;
			}
		}
	}
	printf("%d", t);
	return 0;
}